Universal chat layer for
building bots and agents
A unified TypeScript SDK for building chat bots with type-safe handlers, JSX cards, and multi-platform support—powered by Vercel
$npm install chat
bot.onNewMention(async (thread) => { await thread.subscribe(); await thread.post("Sure! Here's a quick summary...");});bot.onReaction(async (thread, reaction) => { await thread.post(`Thanks for the ${reaction.emoji}!`);});bot.onSubscribedMessage(async (thread, msg) => { await thread.post("Checking now...");});
- 2.5M
- Weekly downloads
- 2.3K
- GitHub stars
- 110+
- Contributors
- 15+
- Adapters
The Platform-Agnostic Chat Toolkit
The open-source chat toolkit designed to help developers build chat bots that run on Slack, Teams, Google Chat, Discord, WhatsApp, and more.
- Multi-platform supportShip to every chat platform from one codebase, without per-platform rewrites.
- Event-driven by designReact to mentions, reactions, and replies with handlers scoped to each thread.
- Type-safe by defaultStrict types for adapters, handlers, and JSX cards, checked at build time.
bot.ts
import { Chat } from "chat";import { createSlackAdapter } from "@chat-adapter/slack";import { createRedisState } from "@chat-adapter/state-redis";
export const bot = new Chat({ userName: "mybot", adapters: { slack: createSlackAdapter(), }, state: createRedisState(),});
bot.onNewMention(async (thread) => { await thread.subscribe(); await thread.post("Hello! I'm listening to this thread now.");});
bot.onSubscribedMessage(async (thread, message) => { await thread.post(`You said: ${message.text}`);});Chat SDK Core
A unified API for building event-driven chat bots. Listen for mentions, subscribe to threads, and post rich cards across multiple platforms.
Supports
Scale with confidence
Plug Chat SDK into an entire ecosystem designed for AI-native chat experiences that scale.
AI SDKBuild AI agents with streaming, tool calls, and structured outputs.
Vercel AI GatewayAccess 100+ models with one API key and no markup.
Vercel SandboxBuild knowledge agents with persistent filesystems to search, index, and read files.
Workflows NEWBuild durable chat agents that suspend, resume, and survive function timeouts.
Build with Chat SDK today
Visit Documentation
$npx create-chat-sdk@latest
Vercel Connect Guide
Authenticate a Slack bot with Vercel Connect instead of stored secrets.
import { createSlackAdapter } from "@chat-adapter/slack";import { connectSlackAdapter } from "@vercel/connect/chat";
const slack = createSlackAdapter({ ...connectSlackAdapter("slack/acme-slack"),});Knowledge Agent Template
Answer questions from synced docs and repos with file-system search.
const savoir = createSavoir({ apiUrl: process.env.SAVOIR_URL, apiKey: process.env.SAVOIR_API_KEY,});
const { text } = await generateText({ model, tools: savoir.tools, maxSteps: 10, prompt: "How do I configure auth?",});Code Review Bot Guide
Review pull requests with sandboxed AI analysis on GitHub.
bot.onNewMention(async (thread, msg) => { const { data: pr } = await octokit.pulls.get({ owner, repo, pull_number, }); await thread.post("Starting code review..."); const review = await reviewPullRequest({ owner, repo, prBranch: pr.head.ref, }); await thread.post(review);});